package net.sareweb.acab.components;

import java.util.List;

import net.sareweb.acab.entity.Travel;
import net.sareweb.acab.entity.manager.TravelManager;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Logger;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.annotations.Scope;
import org.jboss.seam.log.Log;

@Name("homeBean")

@Scope(ScopeType.CONVERSATION)
public class HomesBean {
	
	@Logger
	private Log log;
	@In(create=true)
	TravelManager travelManager;
	

	private List<Travel> lastTravels;
	private List<Travel> travelsSoon;

	public List<Travel> getLastTravels(boolean refresh) {
		if(refresh || lastTravels==null)lastTravels = travelManager.getLastNTravels(20);
		return lastTravels;
	}

	public void setLastTravels(List<Travel> lastTravels) {
		this.lastTravels = lastTravels;
	}

	public List<Travel> getTravelsSoon(boolean refresh) {
		if(refresh || travelsSoon==null)travelsSoon = travelManager.getTravelsSoon();
		return travelsSoon;
	}

	public void setTravelsSoon(List<Travel> travelsSoon) {
		this.travelsSoon = travelsSoon;
	}
	
	
	
	
	
}
